<?php
$itemid = isset($_GET['id'])?$_GET['id']:"";
$result = mysql_query("SELECT `name`,`stock`,`description` FROM `items` WHERE `itemid` = ".$itemid);
$row = mysql_fetch_assoc($result);
?>
<table align="center" width="800" style="">
  <tr>
    <th colspan="4" align="left"><?=$row['name']?></th>
    <td align="left">Stock [<strong style="color:#F00"><?=$row['stock']?></strong>]</td>
    </tr>
    <tr>
    <td colspan="5" align="left">Description : <?=nl2br($row['description'])?></td>
    </tr>
    <tr>
    <th colspan="5" align="left">&nbsp;</th>
    </tr>
    <tr>
    <th align="left">Control #</th>
    <th align="left">Date</th>
    <th align="left">Details</th>    
    <th align="left">Stock Action</th>
    <th align="center">Qty</th>
  </tr>
  <?php
  $tmp = mysql_query("SELECT * FROM `item_logs` WHERE `itemid` = ".$itemid." ORDER BY `date` ASC");
  while($logs = mysql_fetch_assoc($tmp)){
	  echo '<tr>
		<td>'.$logs['id'].'</td>
		<td>'.$logs['date'].'</td>
		<td>'.nl2br($logs['details']).'</td>		
		<td>'.$logs['action'].'</td>
		<td align="center">'.$logs['qty'].'</td>
	  </tr>';
  }
  ?>  
</table>